<template>
      <a-row :class="['p-1', `${prefixCls}--box`]" :gutter="10">
        <a-col :xl="6" :lg="8" :md="10" :sm="24" style="flex: 1">
          <a-card :bordered="false" style="height: 100%">
            <typeTree @select="onTreeSelect" ref="refTree" />
          </a-card>
        </a-col>
        <a-col :xl="18" :lg="16" :md="14" :sm="24" style="flex: 1">
          <a-card :bordered="false" style="height: 100%">
            <!--采购人员-->
            <XlCustomerPurchaseUserList ref="refList" :data="selData" @success="handleReload" />
          </a-card>
        </a-col>
      </a-row>
</template>

<script lang="ts" setup name="eam-basic">
import { provide, ref } from 'vue';
import { useDesign } from '/@/hooks/web/useDesign';
import typeTree from './components/typeTree.vue';
import XlCustomerPurchaseUserList from './XlCustomerPurchaseUserList.vue';

const { prefixCls } = useDesign('depart-user');
provide('prefixCls', prefixCls);

const refTree = ref<{ reloadTree: () => any; onLoadData: () => any; selectedKeys; loadSelKey: (key) => any; } | null>(null);

const refList = ref<{ reload: () => any } | null>(null);

// 当前选中的信息
var selData = ref({});

// 左侧树选择后触发
function onTreeSelect(data) {
  selData.value = data;
  refList.value?.reload();
}

/**
 * 全部页面刷新
 */
function handleReload() {
  //刷新
  refTree.value?.loadSelKey(selData.value);
  refList.value?.reload();
}


</script>
